<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>华猫商城</title>
		<style></style>
		<link href="../css/jquery.validator.css" rel="stylesheet">
		<link href="../css/common.css" rel="stylesheet">

		<link href="../plugin/userLib/css/user.css" rel="stylesheet">
		<link href="../plugin/userLib/css/userinfo.css" rel="stylesheet">
		<link href="../plugin/userLib/css/my_user.css" rel="stylesheet">
		<link href="../css/base.css" rel="stylesheet">
		<style>
			.error_desc_box{
				margin-top:5px;
				display: none;overflow: hidden;
				padding-left: 90px;line-height:50px;
			}
			.reApply{
				display: inline-block;
			    width: 90px;
			    height: 36px;
			    line-height: 36px;
			    text-align: center;
			    border: 1px solid #ed5d2a;
			    color: #ed5d2a;
			    font-size: 16px;
			    cursor: pointer;
			    margin-top: 7px;
			    border-radius: 3px;
			    float:right;
			}
		</style>
	</head>

	<body>
		<div id="header"></div>
		<div id="headerBox"></div>
		<!--<div id="nav_menu"></div>-->
		<div class="ZZHT-wrap">
			<div class="ZZHT-header" style="border-bottom: 1px solid #ffffff;">
				<div class="ZZHT-shop-nav">
					<div class="ZZHT-nav-box">
						<a href="#">
							<li class="liselect ZZHT-lfloat ZZHT-nav-boxa">用户中心</li>
						</a>
						<div class="ZZHT-clear"></div>
					</div>
				</div>
				<div class="ZZHT-clear"></div>
			</div>
			<div class="ZZHT-main">
				<div id="user_left"></div>
				<div class="ZZHT-content">

					<div class="main_identity">
						<div class="identity_list bz">
							<div class="list_left clearfix">
								<i class="shiming fl"><img src="../plugin/userLib/img/user_sprites1.png" width="66" alt="" /></i>
								<div class="list_details fl">
									<h3>实名认证</h3>
									<p>为了您的资金安全，请进行实名认证。</p>
								</div>
								<!--  <div class="ZZHT-clear"></div> -->
							</div>
							<div class="list_right">
								<span class="renzheng" style="display: none;"></span>
								<a class="upgrade indentity-btn to_renzheng" href="real_name.html" style="">认证</a>
								<a class="indentity-btn sh_ing" href="#none" style="display: none;">认证审核中</a>
							</div>
							<div class="ZZHT-clear"></div>
						</div>
						<div class="identity_list bz">
							<div class="list_left clearfix">
								<i class="user-logo fl"><img src="../plugin/userLib/img/user_sprites2.png" width="66" alt="" /></i>
								<div class="list_details fl">
									<h3>用户升级</h3>
									<p>个人用户可升级为主管或经理级别，支付997即可升级为主管，支付9997即可升级为经理，充值后将在7个工作日内生效。</p>
								</div>
							</div>
							<div class="list_right">
								<a class="upgrade indentity-btn grade">升级</a>
								<a class="indentity-btn jingli" href="#none" style="display: none;">经理</a>
							</div>
							<div class="ZZHT-clear"></div>
						</div>
						<div class="identity_list bz">
							<div class="clearfix">
								<div class="list_left clearfix">
									<i class="union-shop fl"><img src="../plugin/userLib/img/user_sprites3.png" width="66" alt="" /></i>
									<div class="list_details fl">
										<h3>联盟商家</h3>
										<p>加入联盟商家可享受更多用户权益。</p>
									</div>
									<div class="ZZHT-clear"></div>
								</div>
								<div class="list_right">
									<a class="apply indentity-btn union" href="#none" style="display: none;">申请</a>
									<a class="apply indentity-btn union_ing" style="display: none;">审核中</a>
									<span class="tong-guo xx_tg" style="display: none;"></span>
								</div>
								<div class="union_desc error_desc_box">
									拒绝原因：<span class="no_content"></span>
									<a class="reApply" href="union.html">重新申请</a>
								</div>
							</div>
						</div>
						<div class="identity_list bz">
							<div class="list_left clearfix">
								<i class="online-mall fl"><img src="../plugin/userLib/img/user_sprites4.png" width="66" alt="" /></i>
								<div class="list_details fl">
									<h3>申请线上商城</h3>
									<p>联盟商家申请线上商城即可开通线上商城功能。</p>
								</div>
							</div>
							<div class="list_right">
								<a class="apply indentity-btn online" style="display: none;">申请</a>
								<a class="apply indentity-btn online_ing" style="display: none;">审核中</a>
								<span class="tong-guo xs_tg" style="display: none;"></span>
							</div>
							<div class="online_desc error_desc_box">
								拒绝原因：<span class="no_content"></span>
								<a class="reApply online">重新申请</a>
							</div>
						</div>
						<div class="identity_list bz">
							<div class="clearfix">
								<div class="list_left clearfix">
									<i class="application-agency fl"><img src="../plugin/userLib/img/user_sprites5.png" width="66" alt="" /></i>
									<div class="list_details fl">
										<h3>申请代理</h3>
										<p>申请代理即可享受区域内业绩分红。</p>
									</div>
								</div>
								<div class="list_right">
									<span class="tong-guo dl_tg" style="display: none;"></span>
									<a class="apply indentity-btn agent">申请</a>
									<a class="apply indentity-btn ash_ing">审核中</a>
								</div>
								<div class="agent_desc error_desc_box">
									拒绝原因：<span class="no_content"></span>
									<a class="reApply agent">重新申请</a>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div style="clear:both;"></div>
			<br>
		</div>
		<div id="ck3"></div>
		<script src="../js/jquery.min.js"></script>
		<script src="../js/vue.min.js"></script>
		<script src="../plugin/layer/layer.js"></script>
		<script type="text/javascript" src="../js/ljf_base.js"></script>
		<script type="text/javascript">
			var sauditStatus = '';//用户是否已经实名认证
			var suserType = '';//用户升级状态
			var shopStatus = '';//线下商城状态
			
			function getUserStatus(back){
				$.ajax({//获取用户状态
					type: "get",
					url: SURL + "users/userIdentity",
					async:false,
					data: {
						"userId":localStorage.userId,
					},
					dataType: 'json',
					success: function(res) {
						console.log(res);
						if(res.messageCode==200){
							return back && back(res.entity);
							
						}else{
							layer.msg(res.message);
						}
					}
				});
			}
			
			$(function(){
				getUserStatus(function(status){
					user_status(status);
				})
			})
			
			function user_status(status){
				console.log(status);
				sauditStatus = status.sauditStatus;
				//用户认证
				if(sauditStatus==""){
					//未认证
					$('.to_renzheng').show();
					$('.renzheng').hide();
					$('.sh_ing').hide();
				}
				if(sauditStatus=="2"){
					//审核不通过 
					$('.to_renzheng').show();
					$('.renzheng').hide();
					$('.sh_ing').hide();
				}
				if(sauditStatus=="0"){
					//审核中
					$('.to_renzheng').hide();
					$('.renzheng').hide();
					$('.sh_ing').show();
				}
				if(sauditStatus=="1"){
					//审核通过
					$('.to_renzheng').hide();
					$('.renzheng').show();
					$('.sh_ing').hide();
				}
				
				//用户身份
				suserType = status.suserType;
				if(status.suserType=="2"){
					//经理
					$('.grade').hide();
					$('.jingli').show();
					$('.jingli').html('经理');
				}
				if(status.suserType=="1"){
					$('.grade').html('升经理');
					$('.grade').show();
					$('.jingli').hide();
				}
				if(status.suserType=="0"){
					$('.grade').html('升级');
					$('.grade').show();
					$('.jingli').hide();
				}
				if(status.sstatus=="1"){//升级中
					//经理
					$('.grade').hide();
					$('.jingli').show();
					$('.jingli').html('升级中');
				}
				
				//线下商家
				shopStatus = status.shopStatus;
				if(shopStatus==""){
					//未申请
					$('.union').html('申请');
					$('.union').show();
				}
				if(shopStatus=="0"){
					//审核中
					$('.union_ing').show();
				}
				if(shopStatus=="1"){
					//是
					$('.xx_tg').show();
				}
				if(shopStatus=="-1"){
					//已拒绝
					$('.union').html('已拒绝');
					$('.union').show();
					$('.union_desc .no_content').html(status.statusDesc);
					$('.union_desc').show();
				}
				
				//线上商家
				if(status.applyStatus==""){
					//未申请
					$('.online').html('申请');
					$('.online').show();
				}
				if(status.applyStatus=="1"){
					//审核中
					$('.online_ing').show();
				}
				if(status.applyStatus=="2"){
					//拒绝
					$('.online').html('已拒绝');
					$('.online').show();
					$('.online_desc .no_content').html(status.applyDesc);
					$('.online_desc').show();
				}
				if(status.applyStatus=="3"){
					//是
					$('.xs_tg').show();
				}
				
				//代理状态
				if(status.sastatus==""){
					//未审核
					$('.agent').show();
					$('.dl_tg').hide();
					$('.ash_ing').hide();
				}
				if(status.sastatus=="-2"){
					//二审拒绝
					$('.agent').hide();
				}
				if(status.sastatus=="-1"){
					//一审拒绝
					$('.agent').show();
					$('.dl_tg').hide();
					$('.ash_ing').hide();
//					$('.agent_desc .no_content').html(status.statusDesc);
					$('.agent_desc').show();
					
				}
				if(status.sastatus=="0"){
					//审核中
					$('.agent').hide();
					$('.dl_tg').hide();
					$('.ash_ing').show();
				}
				if(status.sastatus=="1"){
					//一审同意
					$('.agent').hide();
					$('.dl_tg').show();
					$('.ash_ing').hide();
				}
				if(status.sastatus=="2"){
					//汇款单已上传
				}
				if(status.sastatus=="3"){
					//二审同意
					$('.agent').hide();
					$('.dl_tg').show();
					$('.ash_ing').hide();
				}
			}
			
			function isRZ(status,callback){//判断是否实名认证
				console.log(status);
				if(status==""){
					//未认证
					layer.msg('请先进行实名认证',{icon:6},function(){
						location.href="real_name.html";
					})
				}
				if(status=="2"){
					//审核不通过 
					layer.msg('实名认证未通过，请重新认证');
				}
				if(status=="0"){
					//审核中
					layer.msg('实名认证审核中');
				}
				if(status=="1"){
					//审核通过
					return callback && callback();
				}
			}
			
			$('.grade').click(function(){//用户升级
				isRZ(sauditStatus,function(){
					location.href="grade.html";
				})
			})
			
			$('.union').click(function(){//申请线下
				isRZ(sauditStatus,function(){
					location.href="union.html";
				})
			})
			
			$('.online').click(function(){//申请线上
				//如果不是线下商城
				if(shopStatus!='1'){
					layer.msg('您还不是联盟商家');
				}else{
					location.href="online.html";
				}
			})
			
			$('.agent').click(function(){//点击申请代理
				isRZ(sauditStatus,function(){
					console.log(sauditStatus);
					console.log(suserType);
					if(suserType=='0'||suserType==''){
						layer.msg('请先升级用户');
					}else{
						location.href="agent.html";
					}
				})
			})
		</script>
	</body>

</html>